var ZYRequestClient = require("../../../../utils/zy-request");
var requestClient;
const app = getApp();
Page({
  data:{
    companyId:0,
    companyName:null,
    companyInfo:{},
    authStatusList:['待认证','认证通过','认证失败'],
    navbarData:{
      showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
      title: '企业详情', //导航栏 中间的标题
      white:true
     },
     // 导航头的高度
     height: app.globalData.height * 2 + 20
  },
  onLoad(options) {
    var _this = this;
    requestClient = new ZYRequestClient();
    var companyName = options.companyName;
    _this.setData({
      companyName:companyName
    });
    _this.loadCompanyInfo();
  },
  // 加载公司信息
  loadCompanyInfo(){
    var _this = this;
    var companyName = _this.data.companyName;
    requestClient.getCompanyDetailByNameSingle(companyName,function(res){
      if(res.data.data == null){
        wx.showModal({
          title:'公司不存在',
          content:'该企业已被删除！',
          showCancel:false,
          success(r){
            wx.navigateBack({
              delta: 1,
            })
          }
        })
      } else {
        if(res.data.data.authStatus == null){
          res.data.data.authStatus = 0;
        }
        _this.setData({
          companyInfo:res.data.data
        });
      }
    });
  },
})